<?php


namespace app\home\service;


class WorkerOpenPaiService
{
    //百家乐开牌
    public function get_pai_info_bjl($pai_data)
    {
        $pai_data = $pai_info = json_decode($pai_data, true);
        //h r m f
        $info = [];
        foreach ($pai_info as $key => $value) {
            if ($value == '0|0') {
                unset($pai_info[$key]);
                continue;
            }
            $pai = explode('|', $value);
            if ($key == 1 || $key == 2 || $key == 3) {
                $info['zhuang'][$key] = $pai[1] . $pai[0] . '.png';
            } else {
                $info['xian'][$key] = $pai[1] . $pai[0] . '.png';
            }
        };
        //获取扑克点数
        $card = new OpenPaiCalculationService();
        $pai_result = $card->runs($pai_data);
        return ['result' => $pai_result, 'info' => $info];
    }

    //龙虎开牌
    public function get_pai_info_lh($pai_data)
    {
        $pai_data = $pai_info = json_decode($pai_data, true);
        //获取扑克点数
        $card = new OpenDragonTigerService();
        $pai_result = $card->runs($pai_data);
        return ['result' => $pai_result];
    }
}